package com.hexorld.sprite;

import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Paint;

import com.hexorld.core.Position;
import com.hexorld.core.UpdateFlag;

public class VItem extends HSprite {
	protected Bitmap mBmpSrc;
	protected Paint mPaint = new Paint();
	protected boolean mVisible = true;

	public VItem(Context context) {
		super(context);
		initRes();
	}
	
	public VItem(Context context, int width, int height){
		super(context, width, height);
		initRes();
	}
	public VItem(Context context, int width, int height, Position p) {
		super(context, width, height, p);
		initRes();
	}

	public void setBmpRes(int resId) {
		mBmpSrc = BitmapFactory.decodeResource(mContext.getResources(), resId);
	}
	
	public void initRes(){
		
	}
	
	public void setVisible(boolean visible){
		this.mVisible = visible;
	}
	
	@Override
	public void draw(Canvas canvas) {
		if(canvas == null || !mVisible)
			return;
		if(mBmpSrc != null)
			canvas.drawBitmap(mBmpSrc, null, mDstRect, mPaint);
	}

	@Override
	public void update(UpdateFlag updateFlag) {
		// TODO Auto-generated method stub

	}

}
